<template>
    <div>
        <div>This is Home Page</div>
        <div>This is Home Page</div><span>Count from Pinia:</span><button @click="counter.increment">{{ counter.count
        }}</button>
    </div>
</template>

<script >
import { onMounted } from "vue";
import { useCounterStore } from "../pinia";
export default {
    setup() {
        const counter = useCounterStore()
        onMounted(() => {
            counter.count++
            // 自动补全！ ✨
            counter.$patch({ count: counter.count + 1 })
            console.log("onMounted");
        });
        return {
            counter
        }
    }
}
// 或使用 action 代替


</script> 
